﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tango.Infrastructure.EntityFramework
{
    public sealed class BaseRepository<TAggregateRoot> : Disposable, IRepository<TAggregateRoot>
        where TAggregateRoot : class, IAggregateRoot
    {
        private readonly IDatabase _database;

        public BaseRepository(IDatabase database)
        {
            Check.Argument.IsNotNull(database, "database");

            _database = database;
        }

        public void Add(TAggregateRoot aggregateRoot)
        {
            _database.InsertOnSubmit(aggregateRoot);
        }

        public void Commit()
        {
            _database.Commit();
        }
    }
}
